package com.autosalon.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "POISTOVNA")
public class Poistovna implements Serializable, IModelClass{
	
	@Id
	@GeneratedValue(strategy =GenerationType.AUTO)
	private Long id;
	
	@Column(name = "NAZEV_POISTOVNY", nullable= false, length = 60)
	private String nazevPoistovny;
	
	@OneToMany(cascade=CascadeType.ALL)
	@JoinColumn(name = "ID_POISTOVNY")
	private List<Poisteni> poisteni;
	
	@Column(name = "POPIS_POISTOVNY", nullable= true, length = 300)
	private String description;

	@Override
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getNazevPoistovny() {
		return nazevPoistovny;
	}

	public void setNazevPoistovny(String nazevPoistovny) {
		this.nazevPoistovny = nazevPoistovny;
	}

	public List<Poisteni> getPoisteni() {
		return poisteni;
	}

	public void setPoisteni(List<Poisteni> poisteni) {
		this.poisteni = poisteni;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

        @Override
        public String toString() {
            return nazevPoistovny;
        }
	

}
